#include <QTimer>
#include <QDateTime>
#include <Resources.h>
#include <MainWindow.h>
#include <MessageServices.h>
#include <Constants.h>
#include "Launcher.h"

namespace Domy {

Launcher::Launcher(QObject *parent)
    : QObject(parent),
      m_main_window(new MainWindow())
{

}

Launcher::~Launcher()
{
    delete m_main_window;
    m_main_window = Q_NULLPTR;
}

void Launcher::launch(int argc, char *argv[])
{
    Q_UNUSED(argc)
    Q_UNUSED(argv)

    m_main_window->restoreWindow();

    m_main_window->show();

    domy_resources->loadStyleSheet();

    QStringList init_msg_list;
    init_msg_list << QString("The DomyXML version %1").arg(Version)
                  << QString("Time: %1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
                  << QString("The license is valid until 2088-01-01 00:00:00 !")
                  << QString("@Copyright 2021-2022 The Topmachines Studio Ltd.")
                  << QString()
                  << QString("------------------------------------------------")
                  << QString();

    domy_msg->appendMessages(MsgType_Info, init_msg_list);
}

} // namespace Domy
